let m = [1, 2, 3, 4, 5, 1, 6]
let n = [1, 5, 10, 6, 7, 9, 8, 2, 2]
let arr = []
for (let i = 0; i < n.length; i++) {
    for (let j = 0; j < m.length; j++) {
        if (n[i] === m[j]) {
            arr.push(n[i])
            console.log(n[i]);
        }
    }
}
console.log(arr);
let arr1 = []
arr1 = [...new Set(arr)]
console.log(arr1);